<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Hyves.net - Always in touch with your friends</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="<%=basePath%>/style/main.css" type="text/css"
			rel="stylesheet" />
		<link href="<%=basePath%>/style/style20.css" type="text/css"
			rel="stylesheet" />
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>/style/admin_style.css" />
		<link href="<%=basePath%>/style/pagination.css" type="text/css"
			rel="stylesheet" />
		<script language="javascript"
			src="<%=basePath%>/script/jquery1.3.2.js" type="text/javascript"></script>
		<script language="javascript"
			src="<%=basePath%>/script/jquery.form.js" type="text/javascript"></script>
		<script language="javascript"
			src="<%=basePath%>/script/jquery.pagination.js"
			type="text/javascript"></script>
		<script language="javascript" src="<%=basePath%>/editor/xheditor.js"
			type="text/javascript"></script>
		<script language="javascript"
			src="<%=basePath%>/datePicker/WdatePicker.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
				$(document).ready(function(){
				/* 分页插件Pagination */
				var _total_num = $("#total").val();
				$("#pagination").pagination(_total_num, {
					items_per_page : 10,
					next_show_always : false,
					prev_show_always : false,
					callback : pageselectCallback
				});
				function pageselectCallback(page_index, jq) {
					$.ajax({
						type : "POST",
						dataType : "html",
						url : "<%=basePath%>/news/newsShow",
						data : {
							page_index : page_index,
							maxResult : 10
						},
						success : function(data) {
							$("#ajax_news_list").html(data);
						}
					});
				}
				/* 新建新闻的ajax表单提交 */
				$('#newsSubmitBtn').click(function() {
					$("#newsForm").ajaxSubmit({success : function(data) {
						alert($("#newsSubSubmitBtn").val()+"成功!");
						location.reload();
					}});
					return false;
				});
			});
		</script>
	</head>
	<body>
		<div class="generalbox overview_block">
			<div
				class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
				<div class="box_leftheader generalbox_leftheader">
					<img class="inlineicon transparentpng" height="16" alt=""
						src="<%=basePath%>/images/document.png" width="16" />
					新闻查询
				</div>
				<div class="clearer"></div>
			</div>
			<div
				class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
				<div class="singlecontent_block">
					<form action="<%=basePath%>/news/addSort" method="post"
						id="newsSearchForm">
						<table width="55%" cellspacing="1" cellpadding="0" border="0">
							<tr>
								<td>
									<select name="newsSort.id" id="news_sort_select" />
									<option value="-1">
										所有栏目
									</option>
									<option value="1">
										校园快讯
									</option>
									<option value="2">
										社会热点
									</option>
									</select>
								</td>
								<td>
									<select name="newsSort.id" id="news_sort_select" />
									<option value="-1">
										所有状态
									</option>
									<option value="1">
										已审核
									</option>
									<option value="0">
										未审核
									</option>
									</select>
								</td>
								<td>
									标题：
								</td>
								<td>
									<input type="text" name="newsSort.name" />
								</td>
								<td valign="top" class="BodyTextSmall" colspan="2" align="right">
									<input type="button" id="newsSortSubmitBtn" value="查询" />
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
		<div class="generalbox overview_block">
			<div
				class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
				<div class="box_leftheader generalbox_leftheader">
					<img class="inlineicon transparentpng" height="16" alt=""
						src="<%=basePath%>/images/document.png" width="16" />
					新闻列表&nbsp;(${total })
				</div>
				<div class="clearer"></div>
			</div>
			<div
				class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
				<div class="singlecontent_block">
					<input id="total" type="hidden" value="${total }" />
					<div id="ajax_news_list">
						<img alt="Loading..." src="<%=basePath%>/images/loading.gif"></img>
					</div>
					<div id="pagination" class="pagination paging"></div>
				</div>
			</div>
		</div>
		<br />
		<br />
		<div id="news-show-div"></div>
		<div class="generalbox overview_block" id="news-edit-div">
			<div
				class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
				<div class="box_leftheader generalbox_leftheader">
					<img class="inlineicon transparentpng" height="16" alt=""
						src="<%=basePath%>/images/document.png" width="16" />
					<a href="javascript:void()" id="newsControl">新闻新增</a>
				</div>
				<div class="clearer"></div>
			</div>
			<div
				class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
				<div class="singlecontent_block">
					<form method="post" action="<%=basePath%>/news/addNews"
						id="newsForm">
						<table width="100%" cellpadding="2" cellspacing="1" border="0">
							<tr>
								<td width="12%" class="pn-flabel pn-flabel-h">
									所属栏目：
								</td>
								<td colspan="1" width="38%" class="pn-fcontent">
									<s:select name="newsSort.id" list="newsSortList" headerKey="0" headerValue="栏目名称"
										listKey="id" listValue="name" theme="simple"/>
								</td>
								<td width="12%" class="pn-flabel pn-flabel-h">
									标题：
								</td>
								<td width="38%" class="pn-fcontent">
									<input type="text" size="45" name="news.title" />
								</td>
							</tr>
							<tr>
								<td width="12%" class="pn-flabel pn-flabel-h">
									来源：
								</td>
								<td colspan="1" width="38%" class="pn-fcontent">
									<input type="text" size="35" name="news.from" />
								</td>
								<td width="12%" class="pn-flabel pn-flabel-h">
									简短标题：
								</td>
								<td width="38%" class="pn-fcontent">
									<input type="text" size="45" name="news.shortTitle" />
								</td>
							</tr>
							<tr>
								<td width="12%" class="pn-flabel pn-flabel-h">
									作者：
								</td>
								<td colspan="1" width="38%" class="pn-fcontent">
									<input type="text" value="Ohimy" size="35" name="news.author"/>
								</td>
								<td width="12%" class="pn-flabel pn-flabel-h">
									摘要：
								</td>
								<td colspan="3" width="38%" class="pn-fcontent">
									<textarea cols="31" rows="3"></textarea>
								</td>
							</tr>
							<tr>
								<td width="12%" class="pn-flabel pn-flabel-h">
									Tag标签：
								</td>
								<td colspan="1" width="38%" class="pn-fcontent">
									<input type="text" maxlength="255" name="news.tag" size="28"
										maxlength="255" />
									<span class="pn-fhelp">用,分割</span>
								</td>
								<td width="12%" class="pn-flabel pn-flabel-h">
									阅读权限：
								</td>
								<td colspan="1" width="38%" class="pn-fcontent">
									<select />
									<option value="0" selected="selected">
										不受限制
									</option>
									<option value="1">
										普通会员
									</option>
									</select>
								</td>
							</tr>
							<!-- 
								<tr>
									<td width="12%" class="pn-flabel pn-flabel-h">
										相关文章：
									</td>
									<td colspan="1" width="38%" class="pn-fcontent">
										<input type="text" maxlength="255" name="bean.relatedIds"
											size="35" maxlength="255" />
										<div class="pn-fhelp">
											填写文章ID，多篇文章用,分割
										</div>
									</td>
									<td width="12%" class="pn-flabel pn-flabel-h">
										允许评论：
									</td>
									<td colspan="1" width="38%" class="pn-fcontent">
										<input type="radio" id="_bean.allowComment_0" value="true"
											checked="checked" name="bean.allowComment" />
										<label for="_bean.allowComment_0">
											是
										</label>
										<input type="radio" id="_bean.allowComment_1" value="false"
											name="bean.allowComment" />
										<label for="_bean.allowComment_1">
											否
										</label>
									</td>
								</tr>
								<tr>
									<td width="12%" class="pn-flabel pn-flabel-h">
										是否草稿：
									</td>
									<td colspan="1" width="38%" class="pn-fcontent">
										<input type="radio" id="_bean.draft_0" value="true"
											name="bean.draft" />
										<label for="_bean.draft_0">
											是
										</label>
										<input type="radio" id="_bean.draft_1" value="false"
											checked="checked" name="bean.draft" />
										<label for="_bean.draft_1">
											否
										</label>
									</td>
									<td width="12%" class="pn-flabel pn-flabel-h">
										是否推荐：
									</td>
									<td colspan="1" width="38%" class="pn-fcontent">
										<input type="radio" id="_bean.recommend_0" value="true"
											name="bean.recommend" />
										<label for="_bean.recommend_0">
											是
										</label>
										<input type="radio" id="_bean.recommend_1" value="false"
											checked="checked" name="bean.recommend" />
										<label for="_bean.recommend_1">
											否
										</label>
									</td>
								</tr>
								 -->
							<tr>
								<td width="12%" class="pn-flabel">
									内容：
								</td>
								<td colspan="3" width="88%" class="pn-fcontent">
									<textarea class="xheditor-simple" name="news.content" rows="18"
										style="width: 630px"></textarea>
								</td>
							</tr>
							<tr>
								<td width="12%" class="pn-flabel pn-flabel-h">
									发布时间：
								</td>
								<td colspan="1" width="38%" class="pn-fcontent">
									<input type="text" name="news.created" size="35"
										onfocus="WdatePicker()" class="Wdate" readonly="true" />
									<div class="pn-fhelp">
										不填写则为当前时间
									</div>
								</td>
								<td width="12%" class="pn-flabel pn-flabel-h">
									外部链接：
								</td>
								<td colspan="1" width="38%" class="pn-fcontent">
									<input type="text" size="35" />
									<div class="pn-fhelp">
										链接直接使用该URL
									</div>
								</td>
							</tr>
							<tr>
								<td colspan="4" class="pn-fbutton">
									<input type="button" id="newsSubmitBtn" value="发表" />
									&nbsp;
									<input type="reset" value="重置" />
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>